<% set_title(t(".#{@type}.title_html", :name => printable_element_name(@feature))) %>

<%= render "sidebar_header", :title => t(".#{@type}.title_html", :name => printable_element_name(@feature)) %>

<% if @newer_features_version %>
  <ul id="newer_element_versions_navigation" class="pagination justify-content-center">
    <li class="page-item">
      <%= link_to t(".newer_versions"),
                  params.permit(:show_redactions).merge(:after => @newer_features_version),
                  :class => "page-link",
                  :data => { :turbo => true, :turbo_stream => true } %>
    </li>
  </ul>
<% end %>

<div id="element_versions_list">
  <%= render :partial => "browse/#{@type}", :collection => @old_features %>
</div>

<% if @older_features_version %>
  <ul id="older_element_versions_navigation" class="pagination justify-content-center">
    <li class="page-item">
      <%= link_to t(".older_versions"),
                  params.permit(:show_redactions).merge(:before => @older_features_version),
                  :class => "page-link",
                  :data => { :turbo => true, :turbo_stream => true } %>
    </li>
  </ul>
<% end %>

<div class='secondary-actions mb-3'>
  <%= link_to t("browse.download_xml"), send(:"api_#{@type}_versions_path", @feature.id) %>
  <% if current_user&.moderator? %>
    &middot;
    <% if params["show_redactions"] %>
      <%= tag.span t("browse.view_unredacted_history"), :class => "py-1 px-2 rounded bg-body-secondary" %>
    <% else %>
      <%= link_to t("browse.view_unredacted_history"), params.permit(:before, :after).merge(:show_redactions => true) %>
    <% end %>
  <% end %>
</div>

<nav>
  <ol class="breadcrumb mb-1">
    <li class="breadcrumb-item">
      <%= link_to t(@type, :scope => "browse.versions_navigation"), @current_feature %>
    </li>
    <li class="breadcrumb-item active">
      <% if params[:show_redactions] || params[:before] || params[:after] %>
        <%= link_to t("browse.versions_navigation.history"), {}, :class => "py-1 px-2 rounded bg-body-secondary" %>
      <% else %>
        <%= tag.span t("browse.versions_navigation.history"), :class => "py-1 px-2 rounded bg-body-secondary" %>
      <% end %>
    </li>
    <li class="breadcrumb-item">
      <%= t "browse.versions_navigation.versions_label" %>
    </li>
  </ol>

  <%= numbered_pagination(@current_feature.version, "versions-navigation-active-page-item") do |v|
        { :href => { :action => :show, :version => v },
          :title => t("browse.versions_navigation.version", :version => v) }
      end %>
</nav>
